package com.lkwlw.tplms.system.action;

import java.util.List;

import com.lkwlw.tplms.mapper.TransShipmentStationMapper;
import com.lkwlw.tplms.model.TransShipmentStation;
import com.lkwlw.tplms.model.TransShipmentStationExample;
import com.lkwlw.tplms.repertory.dao.mapper.WarehouseinfoMapper;
import com.lkwlw.tplms.repertory.dao.model.Warehouseinfo;
import com.lkwlw.tplms.repertory.dao.model.WarehouseinfoExample;
import com.lkwlw.tplms.repertory.dao.model.WarehouseinfoExample.Criteria;
import com.lkwlw.tplms.system.dao.mapper.AdmininfoMapper;
import com.lkwlw.tplms.system.dao.mapper.AuthorityMapper;
import com.lkwlw.tplms.system.dao.mapper.UserAuthorityMapper;
import com.lkwlw.tplms.system.dao.model.Admininfo;
import com.lkwlw.tplms.system.dao.model.Authority;
import com.lkwlw.tplms.system.dao.model.AuthorityExample;
import com.lkwlw.tplms.system.dao.model.UserAuthority;
import com.lkwlw.tplms.system.dao.model.UserAuthorityExample;
import com.lkwlw.tplms.transport.dao.mapper.VehicleinfoMapper;
import com.lkwlw.tplms.transport.dao.model.Vehicleinfo;
import com.lkwlw.tplms.transport.dao.model.VehicleinfoExample;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 设置权限
 * @author Administrator
 * 
 */
public class SetAuthorityAction extends ActionSupport {
	private static final long serialVersionUID = 6087190540698782003L;

	private Authority authority;

	private List<Authority> authorityList;

	private String selectIds;

	private AdmininfoMapper admininfoMapper;

	private AuthorityMapper authorityMapper;
	
	private VehicleinfoMapper vehicleinfoMapper;
	
	private WarehouseinfoMapper warehouseinfoMapper;
	
	private UserAuthorityMapper userAuthorityMapper;
	
	private List<Vehicleinfo> vehicleinfos;
	
	private List<Warehouseinfo> warehouseinfos;
	
	private List<UserAuthority> userAuthoritys;

	private Admininfo admininfo;

	private Integer id;
	
	private List<TransShipmentStation> stationsInfos;
	
	private TransShipmentStationMapper transShipStatMapper;
	
	public String execute() {
		// 获取用户信息
		admininfo = admininfoMapper.selectByPrimaryKey(id);

		// 获取权限列表
		authorityList = authorityMapper.selectByExample(new AuthorityExample());
		
		//获取车辆信息
		vehicleinfos = vehicleinfoMapper.selectByExample(new VehicleinfoExample());
		
		WarehouseinfoExample wareExample = new WarehouseinfoExample();
		Criteria c = wareExample.createCriteria();
		c.andUserIdEqualTo(id);
		warehouseinfos = warehouseinfoMapper.selectByExample(wareExample);
		
		UserAuthorityExample userExample = new UserAuthorityExample();
		com.lkwlw.tplms.system.dao.model.UserAuthorityExample.Criteria ci = 
				userExample.createCriteria();
		ci.andUserIdEqualTo(id);
		userAuthoritys = userAuthorityMapper.selectByExample(userExample);
		// 站点信息列表
		stationsInfos = transShipStatMapper.selectByExample(null, new TransShipmentStationExample());
		return SUCCESS;
	}

	public AuthorityMapper getAuthorityMapper() {
		return authorityMapper;
	}

	public void setAuthorityMapper(AuthorityMapper authorityMapper) {
		this.authorityMapper = authorityMapper;
	}

	public Authority getAuthority() {
		return authority;
	}

	public void setAuthority(Authority authority) {
		this.authority = authority;
	}

	public List<Authority> getAuthorityList() {
		return authorityList;
	}

	public void setAuthorityList(List<Authority> authorityList) {
		this.authorityList = authorityList;
	}

	public String getSelectIds() {
		return selectIds;
	}

	public void setSelectIds(String selectIds) {
		this.selectIds = selectIds;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public void setAdmininfoMapper(AdmininfoMapper admininfoMapper) {
		this.admininfoMapper = admininfoMapper;
	}

	public Admininfo getAdmininfo() {
		return admininfo;
	}

	public void setVehicleinfoMapper(VehicleinfoMapper vehicleinfoMapper) {
		this.vehicleinfoMapper = vehicleinfoMapper;
	}

	public List<Vehicleinfo> getVehicleinfos() {
		return vehicleinfos;
	}

	public void setWarehouseinfoMapper(WarehouseinfoMapper warehouseinfoMapper) {
		this.warehouseinfoMapper = warehouseinfoMapper;
	}

	public void setUserAuthorityMapper(UserAuthorityMapper userAuthorityMapper) {
		this.userAuthorityMapper = userAuthorityMapper;
	}

	public List<Warehouseinfo> getWarehouseinfos() {
		return warehouseinfos;
	}

	public List<UserAuthority> getUserAuthoritys() {
		return userAuthoritys;
	}


	public List<TransShipmentStation> getStationsInfos() {
		return stationsInfos;
	}

	public void setStationsInfos(List<TransShipmentStation> stationsInfos) {
		this.stationsInfos = stationsInfos;
	}

	public void setTransShipStatMapper(
			TransShipmentStationMapper transShipStatMapper) {
		this.transShipStatMapper = transShipStatMapper;
	}

}
